<template>
  <div class="detection-content">
          <div class="detectionBox">
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">查看检测报告</div>
                </div>
                <el-table :data="testReportData" border>
                        <el-table-column label="检测时间" align="center" prop="checkTime" />
                        <el-table-column label="检测机构" align="center" prop="organization" />
                        <el-table-column label="操作" align="center">
                              <template slot-scope="scope">
                                  <el-button @click="handleDetail(scope.row)" size="mini" type="text">下载检测报告</el-button>
                            </template>
                         </el-table-column >
                </el-table>
          </div>
            <pagination
              v-show="total>0"
              :total="total"
              :page.sync="params.pageNum"
              :limit.sync="params.pageSize"
              @pagination="getTestReportFn"
            />
            <div class="bottomBtnCss">
                  <el-button @click="goBackBtn">返回</el-button>
            </div>

  </div>
</template>

<script>
 import { getTestReport} from "@/api/zhangping/publicPlaceHealth";
  export default {
    data() {
      return {
         testReportData:[{time:'2024-12-12',case:'还可以'},{time:'2024-12-12',case:'还可以'}],
         params:{
              pageNum:1,
              pageSize:10
         },
         total:0,
         creditCode:null
      };
    },
    created() {
         this.creditCode = this.$route.query.creditCode
        this.getTestReportFn()
    },
    methods: {
        handleDetail(item){
          window.location.href = process.env.VUE_APP_BASE_API + item.report
        },
        getTestReportFn(){
              let data ={
                  creditCode:this.creditCode,
                  ...this.params
              }
             getTestReport(data).then(res=>{
                   if(res.code == 200){
                     this.testReportData = res.rows
                      this.total = res.total
                    }else{
                        this.$message.error(res.msg);
                    }
             })
        },
        goBackBtn(){
          this.$router.back()
        },
    }
  };
</script>
<style lang="scss" scoped>
         .display-fx-center{
             display: flex;
             align-items: center;
         }
         .per100{
             width: 100%!important;
         }
         .soildTop{
             border-top:solid 1px  #D3D8E2;
         }
         .detection-content{
              overflow-y: auto;
              position: relative;
              background-color: #fff;
              padding: 40px 20px;
              border-radius: 10px;
              height: calc( 100vh - 66px - 40px);
             .detectionBox{
                    // max-width: 930px;
                    // margin: 0 auto;
                    padding-bottom:40px;

              }
           .headerBox{
                font-size: 16px;
                color: #484848;
                font-weight: bold;
                // margin-top:40px;/
                margin-bottom:15px;
                @extend .display-fx-center;
                .line{
                  width: 4px;
                  height: 12px;
                  background: #5D85FF;
                  border-radius: 6px 6px 6px 6px;
                  margin-right:6px;
                }
             }
          }
          .bottomBtnCss{
            margin-top: auto;
            text-align: right;
            position: absolute;
            bottom: 20px;
            right: 20px;
        }
        ::v-deep{
           .el-table__header-wrapper th{
                 background: #F4F8FF!important;
           }
        }
</style>
